# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-urlnorm
pkgname=('python2-urlnorm' 'python-urlnorm')
_pkgname=urlnorm
pkgver=1.1.4
pkgrel=7
pkgdesc='Normalize a URL to a standard unicode encoding.'
arch=('any')
url='https://pypi.org/project/urlnorm/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('91d8e536bb54e5a4afcecff02ff832758460c9765c8daa5f84efe0959ffec3151491674b536488a8ba9729dfae11f0fa7fe10c5180052572c5d64d1d622cb52c')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-urlnorm() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-urlnorm() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

